package com.glsc.ngateway.platform.domain;

import cn.hutool.core.annotation.Alias;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

@Entity
@Data
@Table(name = "t_gw_vpn")
@org.hibernate.annotations.Table(appliesTo = "t_gw_vpn",comment = "vpn主表")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Vpn implements Serializable {

    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", columnDefinition = "int(11) comment '主键ID'")
    private Integer id;

    @Alias(value = "#用户名")
    @Column(name = "account", columnDefinition = "varchar(64) comment 'oa账户'")
    private String account;

    @Alias(value = "用户名")
    private String nameExcelAccount;

    @ApiModelProperty(value = "中文名")
    @Column(name = "name", columnDefinition = "varchar(64) comment '中文名'")
    private String name;

    @Alias(value = "描述")
    @ApiModelProperty(value = "描述")
    @Column(name = "remark", columnDefinition = "varchar(255) comment '描述'")
    private String remark;

    @ApiModelProperty(value = "状态")
    @Column(name = "status", columnDefinition = "varchar(10) comment '状态'")
    private String status;

//    @ApiModelProperty(value = "路径id")
//    @Column(name = "path_id", columnDefinition = "varchar(50) comment '路径id'")
//    private String pathId;

    @Alias(value = "所属组路径")
    @ApiModelProperty(value = "路径名称")
    @Column(name = "path_name", columnDefinition = "varchar(600) comment '路径名称'")
    private String pathName;

    @Alias(value = "该用户可访问的资源列表")
    @ApiModelProperty(value = "资源列表")
    @Column(name = "resource_name", columnDefinition = "varchar(8500) comment '资源列表'")
    private String resourceName;

    @Alias(value = "最近一次登陆")
    @ApiModelProperty(value = "最近一次登陆")
    @Column(name = "last_login_time", columnDefinition = "varchar(30) comment '最近一次登陆时间'")
    private String lastLoginTime;

    @Column(name = "department_one")
    @ApiModelProperty(value = "一级部门")
    private String departmentOne;

    @Column(name = "department_one_id")
    @ApiModelProperty(value = "一级部门id")
    private Integer departmentOneId;

    @Column(name = "department_two")
    @Alias(value = "部门")
    @ApiModelProperty(value = "二级部门")
    private String departmentTwo;

    @Column(name = "department_two_id")
    @ApiModelProperty(value = "二级部门id")
    private Integer departmentTwoId;

    @Column(name = "company")
    @ApiModelProperty(value = "公司")
    private String company;

    @ApiModelProperty(value = "非oa，1非oa，0是oa，默认导出oa的数据")
    @Column(name = "not_oa")
    private Integer notOa;

    @ApiModelProperty(value = "0：试用  1：正式  2：临时  3：试用延期 4：解聘  5：离职  6：退休  7：无效 ")
    @Alias(value = "在职状态")
    @Column(name = "oa_status")
    private String OaStatus;

    @Column(name = "insert_time", columnDefinition = "datetime comment '创建时间'")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime insertTime;

//    @Column(name = "update_time", columnDefinition = "datetime comment '更新时间'")
//    @org.hibernate.annotations.UpdateTimestamp
//    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
//    @JsonSerialize(using = LocalDateTimeSerializer.class)
//    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
//    protected LocalDateTime updateTime;

    @Transient
    private Integer pageNo;

    @Transient
    private Integer pageSize;
}
